Change in openvpn[master]: dns: clone options via pointer instead of copy
A message that is not in the archive (sent off-list or not yet received): gerrit.1733989644000.I12b8bb26c0cb70e50b2d42b1c69018894e9f080c@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/835?usp=email
to review the following change.
Change subject: dns: clone options via pointer instead of copy
......................................................................
dns: clone options via pointer instead of copy
---
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/options.c
3 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/35/835/1
src/openvpn/dns.c +6 -4
@@ -248,13 +248,15 @@ }struct dns_options -clone_dns_options (const struct dns_options o,struct gc_arena *gc) +clone_dns_options (const struct dns_options *o,struct gc_arena *gc) {struct dns_options clone; +memset (&clone,0 ,sizeof (clone)); - clone.search_domains =clone_dns_domains (o.search_domains, gc); - clone.servers =clone_dns_servers (o.servers, gc); - clone.servers_prepull =clone_dns_servers (o.servers_prepull, gc); + clone.search_domains =clone_dns_domains (o->search_domains, gc); + clone.servers =clone_dns_servers (o->servers, gc); + clone.servers_prepull =clone_dns_servers (o->servers_prepull, gc); +return clone; }
src/openvpn/dns.h +2 -1
@@ -129,7 +129,8 @@* @param gc Pointer to the gc_arena to use for the clone * @return The dns_options clone */ -struct dns_options clone_dns_options (const struct dns_options o,struct gc_arena *gc); +struct dns_options clone_dns_options (const struct dns_options *o, +struct gc_arena *gc);/** * Saves and resets the server options, so that pulled ones don't mix in.
src/openvpn/options.c +2 -2
@@ -3311,7 +3311,7 @@ o->pre_connect->route_default_gateway = o->route_default_gateway; o->pre_connect->route_ipv6_default_gateway = o->route_ipv6_default_gateway; - o->pre_connect->dns_options =clone_dns_options (o->dns_options, &o->gc); + o->pre_connect->dns_options =clone_dns_options (&o->dns_options, &o->gc);/* NCP related options that can be overwritten by a push */ o->pre_connect->ciphername = o->ciphername;
@@ -3364,7 +3364,7 @@/* Free DNS options and reset them to pre-pull state */ gc_free (&o->dns_options.gc);struct gc_arena dns_gc =gc_new (); - o->dns_options =clone_dns_options (pp->dns_options, &dns_gc); + o->dns_options =clone_dns_options (&pp->dns_options, &dns_gc); o->dns_options.gc = dns_gc;if (pp->client_nat_defined)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/835?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c
Gerrit-Change-Number: 835
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: d12fk, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/835?usp=email )
Change subject: dns: clone options via pointer instead of copy
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/835?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c
Gerrit-Change-Number: 835
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Fri, 13 Dec 2024 16:40:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 dns: clone options via pointer instead of copy
In reply to a message not in the archiveFrom: Heiko Hund <[email protected]...>
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/835
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
src/openvpn/dns.c +6 -4
@@ -248,13 +248,15 @@ }struct dns_options -clone_dns_options (const struct dns_options o,struct gc_arena *gc) +clone_dns_options (const struct dns_options *o,struct gc_arena *gc) {struct dns_options clone; +memset (&clone,0 ,sizeof (clone)); - clone.search_domains =clone_dns_domains (o.search_domains, gc); - clone.servers =clone_dns_servers (o.servers, gc); - clone.servers_prepull =clone_dns_servers (o.servers_prepull, gc); + clone.search_domains =clone_dns_domains (o->search_domains, gc); + clone.servers =clone_dns_servers (o->servers, gc); + clone.servers_prepull =clone_dns_servers (o->servers_prepull, gc); +return clone; }
src/openvpn/dns.h +2 -1
@@ -129,7 +129,8 @@* @param gc Pointer to the gc_arena to use for the clone * @return The dns_options clone */ -struct dns_options clone_dns_options (const struct dns_options o,struct gc_arena *gc); +struct dns_options clone_dns_options (const struct dns_options *o, +struct gc_arena *gc);/** * Saves and resets the server options, so that pulled ones don't mix in.
src/openvpn/options.c +2 -2
@@ -3311,7 +3311,7 @@ o->pre_connect->route_default_gateway = o->route_default_gateway; o->pre_connect->route_ipv6_default_gateway = o->route_ipv6_default_gateway; - o->pre_connect->dns_options =clone_dns_options (o->dns_options, &o->gc); + o->pre_connect->dns_options =clone_dns_options (&o->dns_options, &o->gc);/* NCP related options that can be overwritten by a push */ o->pre_connect->ciphername = o->ciphername;
@@ -3364,7 +3364,7 @@/* Free DNS options and reset them to pre-pull state */ gc_free (&o->dns_options.gc);struct gc_arena dns_gc =gc_new (); - o->dns_options =clone_dns_options (pp->dns_options, &dns_gc); + o->dns_options =clone_dns_options (&pp->dns_options, &dns_gc); o->dns_options.gc = dns_gc;if (pp->client_nat_defined)
[Openvpn-devel] [PATCH applied] Re: dns: clone options via pointer instead of copy
It's not immediately obvious to me why this is a useful change (except "do not copy structs around if not needed"), but the actual change looks good and should not change operational behaviour in any way - no memory handling or anything involved, just "the midlayer" function referencing structure elements via pointer now.
Compile tested :-)
Your patch has been applied to the master branch.
commit db46d4d38bec59435a76bb0968d530b9426c551e
Author: Heiko Hund Date: Fri Dec 13 17:46:30 2024 +0100
dns: clone options via pointer instead of copy
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30112.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/835?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: dns: clone options via pointer instead of copy
......................................................................
dns: clone options via pointer instead of copy
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30112.html
---
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/options.c
3 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/35/835/2
src/openvpn/dns.c +6 -4
@@ -248,13 +248,15 @@ }struct dns_options -clone_dns_options (const struct dns_options o,struct gc_arena *gc) +clone_dns_options (const struct dns_options *o,struct gc_arena *gc) {struct dns_options clone; +memset (&clone,0 ,sizeof (clone)); - clone.search_domains =clone_dns_domains (o.search_domains, gc); - clone.servers =clone_dns_servers (o.servers, gc); - clone.servers_prepull =clone_dns_servers (o.servers_prepull, gc); + clone.search_domains =clone_dns_domains (o->search_domains, gc); + clone.servers =clone_dns_servers (o->servers, gc); + clone.servers_prepull =clone_dns_servers (o->servers_prepull, gc); +return clone; }
src/openvpn/dns.h +2 -1
@@ -129,7 +129,8 @@* @param gc Pointer to the gc_arena to use for the clone * @return The dns_options clone */ -struct dns_options clone_dns_options (const struct dns_options o,struct gc_arena *gc); +struct dns_options clone_dns_options (const struct dns_options *o, +struct gc_arena *gc);/** * Saves and resets the server options, so that pulled ones don't mix in.
src/openvpn/options.c +2 -2
@@ -3311,7 +3311,7 @@ o->pre_connect->route_default_gateway = o->route_default_gateway; o->pre_connect->route_ipv6_default_gateway = o->route_ipv6_default_gateway; - o->pre_connect->dns_options =clone_dns_options (o->dns_options, &o->gc); + o->pre_connect->dns_options =clone_dns_options (&o->dns_options, &o->gc);/* NCP related options that can be overwritten by a push */ o->pre_connect->ciphername = o->ciphername;
@@ -3364,7 +3364,7 @@/* Free DNS options and reset them to pre-pull state */ gc_free (&o->dns_options.gc);struct gc_arena dns_gc =gc_new (); - o->dns_options =clone_dns_options (pp->dns_options, &dns_gc); + o->dns_options =clone_dns_options (&pp->dns_options, &dns_gc); o->dns_options.gc = dns_gc;if (pp->client_nat_defined)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/835?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c
Gerrit-Change-Number: 835
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/835?usp=email )
Change subject: dns: clone options via pointer instead of copy
......................................................................
dns: clone options via pointer instead of copy
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30112.html
---
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/options.c
3 files changed, 10 insertions(+), 7 deletions(-)
src/openvpn/dns.c +6 -4
@@ -248,13 +248,15 @@ }struct dns_options -clone_dns_options (const struct dns_options o,struct gc_arena *gc) +clone_dns_options (const struct dns_options *o,struct gc_arena *gc) {struct dns_options clone; +memset (&clone,0 ,sizeof (clone)); - clone.search_domains =clone_dns_domains (o.search_domains, gc); - clone.servers =clone_dns_servers (o.servers, gc); - clone.servers_prepull =clone_dns_servers (o.servers_prepull, gc); + clone.search_domains =clone_dns_domains (o->search_domains, gc); + clone.servers =clone_dns_servers (o->servers, gc); + clone.servers_prepull =clone_dns_servers (o->servers_prepull, gc); +return clone; }
src/openvpn/dns.h +2 -1
@@ -129,7 +129,8 @@* @param gc Pointer to the gc_arena to use for the clone * @return The dns_options clone */ -struct dns_options clone_dns_options (const struct dns_options o,struct gc_arena *gc); +struct dns_options clone_dns_options (const struct dns_options *o, +struct gc_arena *gc);/** * Saves and resets the server options, so that pulled ones don't mix in.
src/openvpn/options.c +2 -2
@@ -3311,7 +3311,7 @@ o->pre_connect->route_default_gateway = o->route_default_gateway; o->pre_connect->route_ipv6_default_gateway = o->route_ipv6_default_gateway; - o->pre_connect->dns_options =clone_dns_options (o->dns_options, &o->gc); + o->pre_connect->dns_options =clone_dns_options (&o->dns_options, &o->gc);/* NCP related options that can be overwritten by a push */ o->pre_connect->ciphername = o->ciphername;
@@ -3364,7 +3364,7 @@/* Free DNS options and reset them to pre-pull state */ gc_free (&o->dns_options.gc);struct gc_arena dns_gc =gc_new (); - o->dns_options =clone_dns_options (pp->dns_options, &dns_gc); + o->dns_options =clone_dns_options (&pp->dns_options, &dns_gc); o->dns_options.gc = dns_gc;if (pp->client_nat_defined)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/835?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I12b8bb26c0cb70e50b2d42b1c69018894e9f080c
Gerrit-Change-Number: 835
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged